using System.Collections.Generic;
using System.IO;
using UnityEngine;

namespace Light
{
    /// <summary>
    ///     Ŀǰ��ʱ��ָ���ļ����й���
    ///     ��һ�θ��ݴ������Ĺؼ����� �����ֵ��в�ѯ����������ȥ����Э�̽����첽����
    /// </summary>
    public class PrefabManager : SingletonMono<PrefabManager>
    {
        private const string rootForderName = "Resources/prefab";

        private readonly Dictionary<string, string>
            _nameToFilePahtMapping = new(); //����Ԥ�Ƽ����Ƶ�·���Ķ�Ӧ�����μ��ص�ʱ��ʹ��

        private Dictionary<string, GameObject> _nameToGameObject = new(); //��һ�μ��س�������Ҫ����Ϸ���󱣳�һ��ʱ��

        protected override void Awake()
        {
            base.Awake();
            // ��ȡ��Ŀ¼�µ������ļ�·��  
            var files = Directory.GetFiles(rootForderName);

            // �����ļ�·������  
            foreach (var filePath in files)
            {
                // ��ȡ�ļ�����Ϊ�ֵ�ļ�  
                var fileName = Path.GetFileName(filePath);

                // ���ļ���������·�����ӵ��ֵ���  
                _nameToFilePahtMapping.Add(fileName, filePath);
            }
        }

        private void Start()
        {
            foreach (var item in _nameToFilePahtMapping) Debug.Log("Current TEST Content:----" + item);
        }
    }
}